<div class="posts-list post-full">
	<div class="holder">
		<div class="col col-1">
			<h1><?php echo $post['Post']['title'] ?></h1>
			<?php echo $this->element("../posts/elements/meta", array('post'=>$post)); ?>
			<div class="body html">
				<?php 
				$body = $post['Post']['body'];
				if (!empty($post['Image'])) {
					//debug($post['Image']);
					$body = $mediaEmbed->substituteEmbedTags($body);
				}
				
				echo $textile->TextileThis($body); ?>
			</div>
			
			
			
			<?php if (!empty($post['File'])):?>
			<div class="files">
			<h3><?php __("Download files"); ?></h3>
				<ul>
				<?php foreach ($post['File'] as $item):?>
					<?php if(!empty($item['basename'])): ?>
					<li>
						<?php
						if ($file = $medium->file($item)) {
							$url = $medium->url($file);
							$Medium = Medium::factory($file);
							$size = $medium->size($file);

							if (isset($number)) {
								$size = $number->toReadableSize($size);
							} else {
								$size .= ' Bytes';
							}
							printf($html->tags['link'], $url, null, $item['basename'] );
							echo " <span>(".$Medium->name."/".$size.")</span> " . $item['alternative'];
						}
						?>
					</li>
					<?php endif; ?>
				<?php endforeach; ?>
				</ul>
			</div>
			<?php endif; ?>
			
			<?php  echo $html->link(__('Back to posts list', true), array('controller'=>'posts', 'action'=>'index'), array('class'=>'action-link')); ?>
		</div>
		<?php echo $this->element('sidebar'); ?>
	</div>

</div>


